package org.hhchat.others.tercent;

import java.util.Scanner;

/**
 * Created by hh23485 on 2017/9/13.
 */
public class t11 {

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String intpu = scanner.nextLine();
        String[] nums = intpu.split("\\s");
        int a = Integer.valueOf(nums[0]);
        int b = Integer.valueOf(nums[1]);
        int A = Integer.valueOf(nums[2]);
        int B = Integer.valueOf(nums[3]);
        int count=0;
        while(a<A && b<B){
            if(a<=A/2 && b<=B/2){
                A/=2;
                B/=2;
                count++;
            }else{
                A--;
                B--;
                count++;
            }
        }
        if(A==a && b==B){
            System.out.println(count);
        }else{
            System.out.println(-1);
        }

    }
}
